#include <stdio.h>
#include <GL/glut.h>
#include <GL/gl.h>
void setup();
void loop();
void resize(int w, int h);
int main(int argc, char*argv[]){
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
	int hWnd = glutCreateWindow("ARTRIX");
	glutReshapeFunc(resize);
	glutDisplayFunc(loop);
	setup();
	glutMainLoop();
	glutDestroyWindow(hWnd);
	return 0;
}
void resize(GLsizei w, GLsizei h){
	GLfloat aspectRatio;
	if(0 == h)
		h = 1;
	aspectRatio = (GLfloat)w/(GLfloat)h;
	glViewport(0,0,w,h);
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	if(w<=h)
		glOrtho(-100.0, 100.0, -100.0/aspectRatio, 100.0/aspectRatio, 1.0, -1.0);
	else
		glOrtho(-100.0 * aspectRatio, 100.0 * aspectRatio, -100.0, 100.0, 1.0, -1.0);
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
}
void setup(){
	glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
};
void loop(){
	glClear(GL_COLOR_BUFFER_BIT);
	glColor3f(1.0, 0.0f, 0.0f);
	glRectf(-5.0f, 5.0f, 5.0f, -5.0f);
	glutSwapBuffers();
};
	
